function ReadLidarTxt, files, max_line_num=max_line_num
    if(n_elements(max_line_num) eq 0) then max_line_num = 10000L
    
    ;temporary vars, according to file format
    t_year = 0 & t_month = 0 & t_day = 0 & t_hour = 0 & t_minute = 0 & t_second = 0
    t_laser_freq = 0.0D
    t_shot_num = 0.0D
    t_energy = 0.0D
    t_temp_detector = 0.0D & t_temp_box = 0.0D & t_temp_laser = 0.0D
    t_cloud_base_height = 0.0D
    t_background = 0.0D
    t_bintime = 0.0D
    t_maxheight = 0.0D
    t_dead_time_corrected = 0
    t_index = 0LL & t_binnum = 0L
   ; t_data = dblarr(size decided when read t_binnum)
    count = 0LL;
    inited = 0 ; damn idl! why not support zero sized array?
;
;    year = 0 & month = 0 & day = 0 & hour = 0 & minute = 0 & second = 0
;    laser_freq = 0.0D
;    shot_num = 0.0D
;    energy = 0.0D
;    temp_detector = 0.0D & temp_box = 0.0D & temp_laser = 0.0D
;    cloud_base_height = 0.0D
;    background = 0.0D
;    bintime = 0.0D
;    maxheight = 0.0D
;    dead_time_corrected = 0
;    index = 0LL & binnum = 0L
;    data = dblarr(line_size)
    
    for i = 0, n_elements(files) - 1 do begin
        openr, lun, files[i], /get_lun
        while ~ eof(lun) do begin
            readf, lun, t_year, t_month, t_day, t_hour, t_minute, t_second
            readf, lun, t_laser_freq
            readf, lun, t_shot_num
            readf, lun, t_energy
            readf, lun, t_temp_detector, t_temp_box, t_temp_laser
            readf, lun, t_cloud_base_height
            readf, lun, t_background
            readf, lun, t_bintime
            readf, lun, t_maxheight
            readf, lun, t_dead_time_corrected
            readf, lun, t_index, t_binnum
			t_data = dblarr(t_binnum)
            readf, lun, t_data
			
            if( inited eq 0 ) then begin
				year	= intarr(max_line_num);
				month	= intarr(max_line_num);
				day		= intarr(max_line_num);
				hour	= intarr(max_line_num);
				minute	= intarr(max_line_num);
				second	= intarr(max_line_num);
				laser_freq	= dblarr(max_line_num);
				shot_num	= dblarr(max_line_num);
				energy		= dblarr(max_line_num);
				temp_detector	= dblarr(max_line_num);
				temp_box		= dblarr(max_line_num);
				temp_laser		= dblarr(max_line_num);
				cloud_base_height	= dblarr(max_line_num);
				background			= dblarr(max_line_num);
				bintime				= dblarr(max_line_num);
				maxheight			= dblarr(max_line_num);
				dead_time_corrected	= intarr(max_line_num);
				index				= lon64arr(max_line_num);
				binnum				= lonarr(max_line_num);
				data	= dblarr(max_line_num, t_binnum);
				
				count = 0LL;
				inited = 1;
			endif
            year[count] = t_year & month[count] = t_month & day[count] = t_day 
			hour[count] = t_hour & minute[count] = t_minute & second[count] = t_second
            laser_freq[count] = t_laser_freq
            shot_num[count] = t_shot_num
            energy[count] = t_energy
            temp_detector[count] = t_temp_detector & temp_box[count] = t_temp_box & temp_laser[count] = t_temp_laser
            cloud_base_height[count] = t_cloud_base_height
            background[count] = t_background
            bintime[count] = t_bintime
            maxheight[count] = t_maxheight
            dead_time_corrected[count] = t_dead_time_corrected
            index[count] = t_index & binnum[count] = t_binnum
            data[count, *] = t_data

			count++;
        endwhile
        free_lun, lun
    endfor
    
    if(count gt 0) then begin
        julian = julday(month[0:count-1], day[0:count-1], year[0:count-1], hour[0:count-1], minute[0:count-1], second[0:count-1])
		line_size = binnum[0]
    endif
    
    result = { $
        rec_num:count, $
        line_size:line_size, $
        binsize:bintime[0] * 1.5e5, $ ; km
        julian:julian, $
        year:year[0:count-1], month:month[0:count-1], day:day[0:count-1], $ 
		hour:hour[0:count-1], minute:minute[0:count-1], second:second[0:count-1], $
        laser_freq:laser_freq[0:count-1], $
        shot_num:shot_num[0:count-1], $
        energy:energy[0:count-1], $
        temp_detector:temp_detector[0:count-1], temp_box:temp_box[0:count-1], temp_laser:temp_laser[0:count-1], $
        cloud_base_height:cloud_base_height[0:count-1], $
        background:background[0:count-1], $
        bintime:bintime[0:count-1], $
        maxheight:maxheight[0:count-1], $
        dead_time_corrected:dead_time_corrected[0:count-1], $
        index:index[0:count-1], binnum:binnum[0:count-1], $
        data:data[0:count-1,*] $
        }
    
    return, result

end
